package cn.service.impl;

import cn.mapper.HealthAbnormalGroupMapper;
import cn.pojo.HealthAbnormalGroup;
import cn.service.HealthAbnormalGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class HealthAbnormalGroupServiceImpl implements HealthAbnormalGroupService {
    @Autowired
    private HealthAbnormalGroupMapper groupMapper;

    @Override
    public Map<String, Object> save(HealthAbnormalGroup group) {
        Map<String, Object> res = new HashMap<>();
        boolean ok = false;
        try {
            ok = groupMapper.save(group) == 1;
        } catch (Exception e) {
            e.printStackTrace();
            ok = false;
        }
        res.put("msg", ok);
        return res;
    }

    @Override
    public Map<String, Object> update(HealthAbnormalGroup group) {
        Map<String, Object> res = new HashMap<>();
        boolean ok = false;
        try {
            ok = groupMapper.update(group) == 1;
        } catch (Exception e) {
            e.printStackTrace();
            ok = false;
        }
        res.put("msg", ok);
        return res;
    }

    @Override
    public Map<String, Object> delete(Integer no) {
        Map<String, Object> res = new HashMap<>();
        boolean ok = false;
        try {
            ok = groupMapper.delete(no) == 1;
        } catch (Exception e) {
            e.printStackTrace();
            ok = false;
        }
        res.put("msg", ok);
        return res;
    }

    @Override
    public Map<String, Object> select(HealthAbnormalGroup group) {
        Map<String, Object> res = new HashMap<>();
        return res;
    }
}
